home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / Interfaces / PInterfaces / Events.p < prev    next >
Encoding:
Text File  |  1988-11-30  |  2.4 KB  |  128 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Tuesday, August 2, 1988 at 6:20 AM
  3.     Events.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.  1985-1988 
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Events;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingEvents}
  21. {$SETC UsingEvents := 1}
  22.  
  23. {$I+}
  24. {$SETC EventsIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingQuickdraw}
  30. {$I $$Shell(PInterfaces)Quickdraw.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := EventsIncludes}
  33.  
  34. CONST
  35. nullEvent = 0;
  36. mouseDown = 1;
  37. mouseUp = 2;
  38. keyDown = 3;
  39. keyUp = 4;
  40. autoKey = 5;
  41. updateEvt = 6;
  42. diskEvt = 7;
  43. activateEvt = 8;
  44. networkEvt = 10;
  45. driverEvt = 11;
  46. app1Evt = 12;
  47. app2Evt = 13;
  48. app3Evt = 14;
  49. app4Evt = 15;
  50. charCodeMask = $000000FF;
  51. keyCodeMask = $0000FF00;
  52. adbAddrMask = $00FF0000;
  53.  
  54. { event mask equates }
  55.  
  56. mDownMask = 2;
  57. mUpMask = 4;
  58. keyDownMask = 8;
  59. keyUpMask = 16;
  60. autoKeyMask = 32;
  61. updateMask = 64;
  62. diskMask = 128;
  63. activMask = 256;
  64. networkMask = 1024;
  65. driverMask = 2048;
  66. app1Mask = 4096;
  67. app2Mask = 8192;
  68. app3Mask = 16384;
  69. app4Mask = -32768;
  70. everyEvent = -1;
  71.  
  72. { modifiers }
  73.  
  74. activeFlag = 1;     {bit 0 of modifiers for activate event}
  75. btnState = 128;     {Bit 7 of low byte is mouse button state}
  76. cmdKey = 256;       {Bit 0}
  77. shiftKey = 512;     {Bit 1}
  78. alphaLock = 1024;   {Bit 2 }
  79. optionKey = 2048;   {Bit 3 of high byte}
  80. controlKey = 4096;
  81.  
  82.  
  83. TYPE
  84.  
  85.  
  86. EventRecord = RECORD
  87.     what: INTEGER;
  88.     message: LONGINT;
  89.     when: LONGINT;
  90.     where: Point;
  91.     modifiers: INTEGER;
  92.     END;
  93.  
  94. KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  95.  
  96.  
  97.  
  98. FUNCTION GetNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  99.     INLINE $A970;
  100. FUNCTION WaitNextEvent(mask: INTEGER;VAR event: EventRecord;sleep: LONGINT;
  101.     mouseRgn: RgnHandle): BOOLEAN;
  102.     INLINE $A860;
  103. FUNCTION EventAvail(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  104.     INLINE $A971;
  105. PROCEDURE GetMouse(VAR mouseLoc: Point);
  106.     INLINE $A972;
  107. FUNCTION Button: BOOLEAN;
  108.     INLINE $A974;
  109. FUNCTION StillDown: BOOLEAN;
  110.     INLINE $A973;
  111. FUNCTION WaitMouseUp: BOOLEAN;
  112.     INLINE $A977;
  113. PROCEDURE GetKeys(VAR theKeys: KeyMap);
  114.     INLINE $A976;
  115. FUNCTION TickCount: LONGINT;
  116.     INLINE $A975;
  117. FUNCTION GetDblTime: LONGINT;
  118.     INLINE $2EB8,$02F0;
  119. FUNCTION GetCaretTime: LONGINT;
  120.     INLINE $2EB8,$02F4;
  121.  
  122. {$ENDC}    { UsingEvents }
  123.  
  124. {$IFC NOT UsingIncludes}
  125.     END.
  126. {$ENDC}
  127.  
  128.